package com.edu.web.servlet;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.edu.entity.Shop;
import com.edu.entity.Shopping;
import com.edu.service.UserService;
import com.edu.service.impl.UserServiceImpl;

/**
 * Servlet implementation class sidepageServlet
 */
@WebServlet("/sidepageServlet")
public class sidepageServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public sidepageServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		UserService shopService=new UserServiceImpl();
		List<Shop> listed=shopService.queryalls();
		request.setAttribute("listed", listed);
		List<Shop> newlist=shopService.select();
		request.setAttribute("newlist",newlist );
		
		int aid=Integer.parseInt(request.getParameter("aid"));
		List<Shop> newlisted=shopService.alls(aid);
		request.setAttribute("newlisted",newlisted );
		System.out.println(newlisted);
		request.getRequestDispatcher("subpage.jsp").forward(request, response);
		
	}
	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
	}

}
